package com.hsgene.order.service.api;

import com.hsgene.common.util.result.ApiResult;
import com.hsgene.order.service.api.impl.ProductServiceImpl;
import com.hsgene.product.domain.GeneticTestingPackage;
import com.hsgene.product.dto.peanut.GeneticTestingPackageDetilPeanutDto;
import com.hsgene.product.dto.peanut.GeneticTestingProductDetailDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @desc:基因检测套餐管理
 * @author: fuxiang
 * @date: 2018/9/18 16:01
 */
@FeignClient(name = "ms-mod-product", path = "/v1.0/genetic/testing/packages", fallback = ProductServiceImpl.class)
public interface ProductService {

    /**
     * 套餐详情
     *
     * @param id
     * @return
     */
    @GetMapping("{id}")
    ApiResult<GeneticTestingPackage> getPackageById(
            @PathVariable("id") String id, @RequestParam("platform") Integer platform);

    /**
     * 套餐是否被用
     *
     * @param geneticTestingPackage
     * @return
     */
    @PutMapping
    ApiResult updateProduct(@RequestBody GeneticTestingPackage geneticTestingPackage);

    /**
     * 标记套餐被使用（批量）
     *
     * @param ids id数组
     * @return
     */
    @PutMapping("tag/use")
    ApiResult tagPackage(@RequestBody List<String> ids);

    /***
     * 花生仁查询套餐检测信息
     * @author jcl
     * @date 2019/1/8 9:51
     * @param packageId 套餐id
     * @param agencyId 机构id
     * @return
     */
    @GetMapping("products/details/{product_detail_id}/{agency_id}")
    ApiResult<GeneticTestingProductDetailDto> packageTestingInfo(@PathVariable("product_detail_id") String packageId,
                                                                 @PathVariable("agency_id") String agencyId);

    /**
     * 根据套餐id查找对应检测方式
     *
     * @param id
     * @return
     */
    @GetMapping("{package_id}/products")
    ApiResult<List<GeneticTestingPackageDetilPeanutDto>> getDetailsByPackageId(@PathVariable("package_id") String id);
}
